#!/bin/sh
#desc:Start a playlist in mpg123
#package:odmusic
#type:local

CONFIGFILE="/etc/opendomo/music.conf"
. $CONFIGFILE

# Convert cover parameter in album, multiple album support

for album in "$@"; do 
	# Clean pending temporal file and create new

	echo -n "" >$TMPPENDING
	cat $TMPDATABASE | grep "$album" | cut -f2 -d"(" | cut -f1 -d")" | uniq >>$TMPPENDING
done

# Start music service

/etc/init.d/music start

# Wait a moment, please ... for player start

sleep 2

# Always return to music web controler

/usr/local/opendomo/musicControl.sh

